$(function() {
    function bd(obj1,obj2,obj3){
                l=0;
                m=-949*3
                 obj1.css({left:m+"px"})
                obj3.on("click",function(){
                    if(obj2.is(":animated")){
                        return;
                    }
                    l-=949
                    m+=949
                if ((l==-3796)&&(m==949)) {
                   obj2.animate({left: 0}, 500);  
                   obj1.animate({left: -949*3}, 500); 

                  l=0;
                  m=-949*3
                }else{
                 obj2.animate({left: l+"px"}, 500);  
                 obj1.animate({left: m+"px"}, 500);  
                }
            })
            
        }
        for(var i=0;i<3;i++){
            var a1=$(".floor:eq("+i+") .rightBot ul");
            var b1=$(".floor:eq("+i+") .rightTop ul");
            var c1=$(".floor:eq("+i+") .more");
            bd(b1,a1,c1);
        }
  function show(title,list){
    var floorTab=document.getElementById(title);
    var li=floorTab.getElementsByTagName("li");
    var bd=$(list);
    var div=$(list+" .right");
    var len=div.length;
    function inti(){
        for(var i=1;i<len;i++){
            div[i].style.display="none";
        }
    }
    inti();     
        
        for(var i=0;i<len;i++){
            li[i].index=i;
            li[i].onmouseenter=function(){
                for(var i=0;i<len;i++){
                    div[i].style.display="none";
                    li[i].className="";               
                }
                div[this.index].style.display="block";
                li[this.index].className="pink";
            }
            // li[i].onmouseleave=function(){
            //     for(var i=0;i<ul.length;i++){
            //         ul[i].style.display="none"
            //     }
            //     ul[0].style.display="block";
            // }
        }
    }
    show("floorTab","#bd"); 
    show("floorTab1","#bd1");
    show("floorTab2","#bd2");
        var t;
        t=setInterval(function(){
          $(".gray_panel .bd div").animate({top:-90},1000,function(){
            $(this).find("dl").first().appendTo(this);
            $(this).css({top:0});
          })
        },2000);
        $(".gray_panel .bd div").hover(function(){
          clearInterval(t);
        });
        $(".gray_panel .bd div").mouseleave(function(){
          t=setInterval(function(){
            $(".gray_panel .bd div").animate({top:-90},1000,function(){
              $(this).find("dl").first().appendTo(this);
              $(this).css({top:0});
            })
          },2000);
        })

$('.product_list   img').attr({width:240,height:200})
$('.floor_products   img').attr({width:220,height:240})
$('.dbl  img').attr({width:243,height:438})
$('.app_download   img').attr({width:124,height:124})
$('.cartoon   img').attr({width:466,height:140})
$('.weixin   img').attr({width:122,height:122})

$('.floor img').each(function(index,ele){
  var address=$(ele).attr('src')
    $(ele).attr('src','img/lazy_load.png')
    $(ele).attr({'data-original':address})
    $(ele).lazyload({
    threshold : -100
   })

})    


})


    function clock(){
        var hour = document.getElementById("hour");
        var min = document.getElementById("min");
        var second = document.getElementById("second");
        var num = 0;// 旋转度数
        var r = 50;//半径
        var i =0;
        function show(){
            num += 6;
            min.style.transform = "rotate("+num+"deg)";
            if(num%360 == 0){
                var num1 = num/360*6;
                hour.style.transform = "rotate("+num1+"deg)";
            }
        }
        setInterval(show,800);
        function show2(){
            second.style.top =40.5+r * Math.sin(Math.PI/180*i) + "px";
            second.style.left =41.3+r * Math.cos(Math.PI/180*i) + "px";
            i++;
        }
        setInterval(show2,20);
    }
    clock();